<?php

use Dcat\Admin\Admin;
use Dcat\Admin\Grid;
use Dcat\Admin\Form;
use Dcat\Admin\Grid\Filter;
use Dcat\Admin\Show;

/**
 * Dcat-admin - admin builder based on Laravel.
 * @author jqh <https://github.com/jqhph>
 *
 * Bootstraper for Admin.
 *
 * Here you can remove builtin form field:
 *
 * extend custom field:
 * Dcat\Admin\Form::extend('php', PHPEditor::class);
 * Dcat\Admin\Grid\Column::extend('php', PHPEditor::class);
 * Dcat\Admin\Grid\Filter::extend('php', PHPEditor::class);
 *
 * Or require js and css assets:
 * Admin::css('/packages/prettydocs/css/styles.css');
 * Admin::js('/packages/prettydocs/js/main.js');
 *
 */
Grid::resolving(function (Grid $grid) {
    //设置表格全局默认的操作
    $grid->disableViewButton();//禁用查看按钮
    $grid->disableRowSelector();//禁用多行选择
    $grid->disableRefreshButton();//禁用刷新按钮
    $grid->withBorder(true);
    $grid->paginate(15);
});

Form::resolving(function (Form $form){
    //设置表单全局默认的操作
    $form->disableViewButton();//禁用查看按钮
    $form->disableEditingCheck();//禁用编辑选项
    $form->disableCreatingCheck();//禁用继续新增选项
});
//优化 grid 固定列以后的滚动条样式
$js=<<<EOF
    $(function(){
        $(".table-wrap.table-main").removeAttr("style");
        $(".table-wrap.table-fixed-right").removeAttr("style");
        $(".table-wrap.table-fixed-left").removeAttr("style");
    });
EOF;
Admin::script($js);
$css=<<<EOF
.table-wrap.table-main{overflow-y:hidden;}
.table.custom-data-table.data-table tbody td,.complex-headers tbody tr td{
    height: 40px!important;
    padding: 0.3rem 0.5rem;
}
.navbar-fixed-top .content-wrapper{
    padding-top:5.5rem;
}
.breadcrumbs-top{
    margin-bottom:5px!important;
}
EOF;
Admin::style($css);


//将框架视图重定向到/resource/views/dcat/下，修改界面不再需要修改/vendor
//app('view')->prependNamespace('admin', resource_path('views/dcat'));
